#e
#Title[ԕuJԁv]
#Text[]
#PlayLevel[]
#Image[.\img\.png]
#BackGround[Default]
#BGM[\bgm\Rin's Theme.mp3]
#ScriptVersion[2]

script_enemy_main {
	let imgEnemy = GetCurrentScriptDirectory ~ "img\s_rin.png";
	#include_function ".\lib\lib_common.txt"

	@Initialize {
		SetMovePosition02(GetCenterX, GetClipMinY + 90, 60);
		SetLife(600);
		SetDamageRate(20,20);
		SetScore(300000);
		SetTimer(60);
		CutIn(KOUMA, "ԕuJԁv", "script\img\s_rin1.png", 129, 0, 256, 256);
		LoadGraphic(imgEnemy);
		SetTexture(imgEnemy);
		SetGraphicRect(1, 1, 34, 66);
		SetInvincibility(180);

		mainTask;
		SE;
	}

	@MainLoop {
		SetCollisionA(GetX, GetY, 24);
		SetCollisionB(GetX, GetY, 24);
		yield;
	}

	@DrawLoop {
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetTexture(imgEnemy);
		DrawGraphic(GetX, GetY);
	}

	@Finalize  {
		DeleteGraphic(imgEnemy);
	}

	task mainTask {

		loop
		{


		let color1= RED21;
		let color2= RED01;


		loop(8){loop(90) {yield;}

		loop(2){yield;}
		CreateShotA("shot", rand(GetClipMinX,GetClipMaxX), GetClipMaxY, 0);
		SetShotDataA("shot", 0, 3, 270, 0, rand(-0.007,-0.015), 0, color1);
		SetShotDataA("shot", 150, 0, NULL, 0, 0, 0, color2);
		SetShotKillTime("shot", 151);
		

		let angle= rand(0,360/24);
		while(angle<360){
		let shot1= 1;
		CreateShotA(shot1, 0, 0, 0);
		SetShotDataA(shot1, 0, 2.8, angle, 0, 0, 3, color2);
		AddShot(150, "shot", shot1, 0);
		angle+= 360/24;
		}

		let angle2= rand(0,360/24);
		while(angle2<360){
		let shot2= 2;
		CreateShotA(shot2, 0, 0, 0);
		SetShotDataA(shot2, 0, 2, angle2, 0, 0, 2.2, color2);
		AddShot(150, "shot", shot2, 0);
		angle2+= 360/24;
		}

		let angle3= rand(0,360/24);
		while(angle3<360){
		let shot3= 2;
		CreateShotA(shot3, 0, 0, 0);
		SetShotDataA(shot3, 0, 1.2, angle3, 0, 0, 1.4, color2);
		AddShot(150, "shot", shot3, 0);
		angle3+= 360/24;
		}


		FireShot("shot");
		color1++;
		color2++;
		}
	}

	}

	task SE{

	loop(240) {yield;}

		loop
		{PlaySE(se_tan00);
		loop(90) {yield;}

		}


	}


}
